package com.javasea.web.time.demo;

import com.javasea.web.time.demo.entity.User;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.util.Date;

/**
 *@ClassName Controller
 *@Description TODO
 *@Author longxiaonan@163.com
 *@Date 2022/3/12 0012 14:43
 */
@RestController
@RequestMapping("/test")
public class Controller {
    // http://localhost:8080/test/user?d1=2021-03-12%2000:12:25&d2=2021-03-12%2000:12:25
    @GetMapping("/user")
    public User test(User user){
        System.out.println(user);
        User user1 = new User();
        user1.setD1(new Date());
        user1.setD2(LocalDateTime.now());
        return user1;
    }

    @PostMapping("/user")
    public User test2(@RequestBody User user){
        System.out.println(user);
        User user1 = new User();
        user1.setD1(new Date());
        user1.setD2(LocalDateTime.now());
        return user1;
    }
}
